﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;

namespace PSPmmo.LoginServer.Network
{
    partial class PacketHandler
    {
        NetworkStream clientStream;
        TcpClient tcpClient;

        public PacketHandler(TcpClient tcpClient)
        {
            this.tcpClient = tcpClient;
            this.clientStream = tcpClient.GetStream();
        }

        public void Handle(Packet packet)
        {
            try
            {

                if ((Opcodes)packet.GetOpcode() == Opcodes.Auth)
                    HandleAuth(packet);
                else if ((Opcodes)packet.GetOpcode() == Opcodes.UNK)
                    Console.WriteLine("Unknow packet recieved");
            }
            catch (NullReferenceException)
            {
                return;
            }
        }        
    }
}
